package play.modules.m4fcity;

import com.google.gson.JsonObject;

/**
 * The Class M4FCityProfile.
 * 
 * @author David Basoko (david.basoko@m4f.es)
 * @copyright m4f (http://m4f.es)
 */
public class M4FCityProfile {
	/** The id. */
	private String id;
	
	/** The first email. */
	private String email;
	
	/** The first name. */
	private String firstName;
	
	/** The last name. */
	private String lastName;
	
	/** The organization id. */
	private Long organization;
	
	/** The manager flag. */
	private boolean manager;
	
	/** The access token. */
	private String accessToken;
	
	private M4FCityApiService service;
	
	public M4FCityProfile() {}
	
	public M4FCityProfile(String id, String email, String firstName, Long organization, boolean manager, String accessToken) {
		this.id = id;
		this.email = email;
		this.firstName = firstName;
		this.organization = organization;
		this.manager = manager;
		this.accessToken = accessToken;
	}
	
	public M4FCityProfile(JsonObject data) {
		String m4fcityId = data.get("id").getAsString();
		String email = data.get("email").getAsString();
		String name = data.get("surname").getAsString();
		Long organization = data.get("organization").getAsLong();
		String token = data.get("accessToken").getAsString();
		
		this.id = m4fcityId;
		this.email = email;
		this.firstName = name;
		this.organization = organization;
		this.manager = false;
		this.accessToken = token;
	}
	
	public void setId(String id) {
		this.id = id;
	}
	
	public String getId() {
		return this.id;
	}
	
	public void setEmail(String email) {
		this.email = email;
	}
	
	public String getEmail() {
		return this.email;
	}
	
	public void setFirstName(String firstName) {
		this.firstName = this.firstName;
	}
	
	public String getFirstName() {
		return this.firstName;
	}
	
	public void setLastName(String lastName) {
		this.firstName = this.lastName;
	}
	
	public String getLastName() {
		return this.lastName;
	}
	
	public void setOrganization(Long organization) {
		this.organization = this.organization;
	}
	
	public Long getOrganization() {
		return this.organization;
	}
	
	public void setManager(boolean manager) {
		this.organization = this.organization;
	}
	
	public boolean isManager() {
		return this.manager;
	}
	
	public void setAccessToken(String accessToken) {
		this.accessToken = this.accessToken;
	}
	
	public String getAccessToken() {
		return this.accessToken;
	}
	
	public M4FCityApiService getService() {
		return new M4FCityApiService(this);
	}
}	
